package com.glut.service.impl;

import com.github.pagehelper.Page;
import com.glut.mapper.SstsUsersMapper;
import com.glut.service.SstsUsersService;
import com.glut.vo.SstsUsers;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author:沈林玉
 * @date:2020/2/3 10:36
 * @Description:
 */
@Service("sstsUsersService")
public class SstsUsersServiceImpl implements SstsUsersService {

    @Resource
    private SstsUsersMapper sstsUsersMapper;
    /**
     * 1.用户登录
     * @param users
     * @return
     */
    @Override
    public SstsUsers login(SstsUsers users) {

        return sstsUsersMapper.sstsUsersLogin(users);
    }

    /**
     * 2.查看学生账号
     * @param users
     * @return
     */
    @Override
    public Page<SstsUsers> selectStudent(@Param("users")SstsUsers users,
                                         @Param("pageNum") int pageNum,
                                         @Param("pageSize") int pageSize){
        return sstsUsersMapper.selectStudent(users,pageNum,pageSize);
    }

    /**
     * 3.通过id查看学生账号
     * @param users
     * @return
     */
    @Override
    public SstsUsers selectStudentById(SstsUsers users){

        return sstsUsersMapper.selectStudentById(users);
    }

    /**
     * 3.教师新增学生账号
     * @param users
     * @return
     */
    @Override
    public int insertStudent(SstsUsers users){
        return sstsUsersMapper.insertStudent(users);
    }


    /**
     * 4.更新学生账号
     * @param users
     * @return
     */
    @Override
    public int updateStudent(SstsUsers users){
        return sstsUsersMapper.updateStudent(users);
    }

    /**
     * 5.删除学生账号
     * @param users
     * @return
     */
    @Override
    public int deleteStudent(SstsUsers users){

        return sstsUsersMapper.deleteStudent(users);
    }
}
